
<div class="card mb-2">
	<div class="card-body search-form">
		<form id="stockInfo-search-form">
			<input type="hidden" id="stockInfo_pageNumber" name="pageNumber">
			<div class="row align-items-center">
				<div class="col">
					<div class="row align-items-center">
						<div class="col-2">
							<input type="hidden" name="supplier_info_id" id="stockInfo_search_supplier_info_id">
							<input type="text" class="form-control" placeholder="请输入供应商名称或简码"  id="stockInfo_search_supplier_info_keyword" autocomplete="off">
						</div>
						<div class="col-2">
							<select class="form-select search-input" name="goods_category_id" id="stockInfo_search_goods_category_id">
								<option value="">商品分类</option> 
								#for(x : topCategoryList)
								#@goodsCategoryOptions(0, x, "")
								#end
							</select>
						</div>
						<div class="col-3">
							<input type="text" class="form-control" placeholder="商品名称/简码/条码" name="keyword" onclick="$(this).select();">
						</div>
						<div class="col align-self-center">
							<button type="submit" class="btn btn-sm btn-primary" onclick="stockInfo.search(this);">
								<i class="bi bi-search"></i>搜索
							</button>
						</div>
					</div>
					<div id="stockInfo_expand_filter" style="display: none;">
						
					</div>
				</div>
			</div>

		</form>
	</div>
</div>
<div id="data-list-stockInfo"></div>

<script type="application/javascript">
if(typeof(stockInfo) == "undefined") {
	stockInfo = {};
}

$(function() {
	// 初始化bootstrap相关组件
	common.initBootstrap();
	// 加载列表
	stockInfo.list();
	
	$('#stockInfo_search_goods_category_id').on('change', function() {
		stockInfo.list();
	});
	
	stockInfo.loadingSupplierList();
});

stockInfo.list = function(targetId, callback) {
	var hideWarnFlag = $("#stockInfo_hide_warn_flag").prop("checked");
	if(typeof(hideWarnFlag) == 'undefined') {
		hideWarnFlag = false;
	}
	var hideStopFlag = $("#stockInfo_hide_stop_flag").prop("checked");
	if(typeof(hideStopFlag) == 'undefined') {
		hideStopFlag = true;
	}
	var hideZeroFlag = $("#stockInfo_hide_zero_flag").prop("checked");
	if(typeof(hideZeroFlag) == 'undefined') {
		hideZeroFlag = false;
	}
	$("#stockInfo_pageNumber").val(1);
	beekit.ajaxFillPage("/inventory/stock/info/list?hide_stop_flag="+hideStopFlag+"&hide_zero_flag="+hideZeroFlag+"&hide_warn_flag="+hideWarnFlag, "#stockInfo-search-form", "#data-list-stockInfo" ,"stockInfo-data-"+targetId, callback);
};

stockInfo.add = function() {
	beekit.modal("/inventory/stock/info/add");
};

stockInfo.search = function(othis) {
	common.loadingSearch(othis);
	stockInfo.list("", function(ret) {
		common.restoreSearch(othis);
	});
};

stockInfo.loadingSupplierList = function() {
	beekit.autocomplete("#stockInfo_search_supplier_info_keyword", "/inventory/supplier/info/listByJson", "#stockInfo_search_supplier_info_id", function() {
		stockInfo.list();
	});
}
		
</script>


